package com.example.rabbitmqspringboot.consumer;

import com.example.rabbitmqspringboot.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author zfj
 * @date 2022/4/26 -16:59
 * 接收消息
 */
@Component
@Slf4j
public class Consumer {
	public static final String CONFIRM_QUEUE_NAME = "confirm.queue";
	@RabbitListener(queues =CONFIRM_QUEUE_NAME)
	public void receiveMsg(Message message){
		String msg=new String(message.getBody());
		log.info("接受到队列 confirm.queue 消息:{}",msg);
	}
}

